<template>
  <div>
      <h1>用户</h1>
      <hr />
      count:{{ $store.state.cart.count }}
      <hr />
      count10:{{ $store.getters['cart/count10'] }}
      <hr />
      <button @click="handlerAddCount">+1 mutations</button>
      &nbsp; &nbsp;
      <button @click="handlerAddCountN">+N mutations</button>
      &nbsp; &nbsp;
      <button @click="handlerAddCountAction">+1 action</button>
      &nbsp; &nbsp;
      <button @click="handlerAddCountActionN">+N action</button>

  </div>
</template>

<script>
export default {
  methods:{
      handlerAddCountAction() {
          this.$store.dispatch('cart/addCountAction')
      },
      handlerAddCountActionN() {
          this.$store.dispatch('cart/addCountActionN',{
              a:10,
              b:20
          })
      },
      handlerAddCount() {
          // 用户下的addCount
          this.$store.commit("cart/addCount")
      },
      handlerAddCountN() {
          this.$store.commit('cart/addCountN',{
              a:10,
              b:20
          })
      }
  }
};
</script>

<style>

</style>
